import { defineStore } from 'pinia'

export const useMedicalStore = defineStore('medical', {
  state: () => ({
    chatHistory: [],
    chatHistoryList: [] // 新增历史聊天记录列表
  }),
  actions: {
    sendQuestion(question) {
      this.chatHistory.push({
        type: 'question',
        content: question,
        displayContent: question // 确保 displayContent 被正确设置
      });

      console.log(this.chatHistory)
    },
    saveChatHistory() {
      // 将当前聊天记录添加到历史列表
      if (this.chatHistory.length > 0) {
        this.chatHistoryList.push([...this.chatHistory]);
      }
    },
    clearChatHistory() {
      // 清空当前聊天记录
      this.chatHistory = [];
    }
  }
});